package com.th.therp.mapper;

import com.th.therp.pojo.emtity.Store;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StoreMapper {

    //查询全部仓库
    @Select("select * from store where is_deleted = 0")
    List<Store> list();

    //新增仓库
    @Insert("insert into store (name,comment,is_deleted) values (#{name},#{comment},0)")
    void add(Store store);

    void update(Store store);

    //根据id查询仓库名
    @Select("select name from store where id = #{storeId}")
    String findNameById(Integer storeId);

    //根据名称查询仓库
    @Select("select * from store where name=#{name} and is_deleted=0")
    Store findByName(String name);
}